package com.sneakxy.cloudbase.platform.handler;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.multipart.support.StandardServletMultipartResolver;

import com.sneakxy.cloudbase.platform.utils.web.MultipartHandler;

public class StandardServletMultipartResolverHandler extends StandardServletMultipartResolver {
	
	@Autowired(required=false)
	private MultipartHandler[] handlers;
	
	@Override
	public boolean isMultipart(HttpServletRequest request) {
		if(handlers != null) {
			for(MultipartHandler handler : handlers) {
				if(!handler.isMultipart(request)) {
					return false;
				}
			}
		}
		return super.isMultipart(request);
	}

}
